/*
 *  UI管理器
 *  todo: 暂时不写
 * 
 * */
class UIManager
{
    public static createInstance(stage : egret.Stage)
    {
        UIManager._ins = new UIManager(stage);
    }

    public static get Ins () : UIManager
    {
        return UIManager._ins;
    }

    public show(wnd : eui.Component)
    {
        if(this.checkExist(wnd))
        {

        }
        this._uiRoot.addChild(wnd);
    }


    private checkExist(wnd : eui.Component) : boolean
    {
        let cnt = this._allUIs.length;

        for(let i = 0; i < cnt; i ++)
        {
            let node = this._allUIs[i];
            if(node == wnd)
            {
                return true;
            }
        }

        return false;
    }

    private constructor(stage : egret.Stage)
    {
        this._uiRoot = stage;
        this._allUIs = new Array<eui.Component>();
    }

    private test : {[index:string]:eui.Component} = {}
    

    private _allUIs : Array<eui.Component>;
    private static _ins : UIManager;
    private _uiRoot : egret.Stage;
}